home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / pcboard / msgtag11.zip / READ.PPS < prev    next >
Text File  |  1996-01-30  |  11KB  |  353 lines

  1. ;   READ.PPE - Written by Dan Shore - SysOp
  2. ;                         The Shoreline BBS
  3. ;──────────────────────────────────────────────────────────────────────────────
  4. ;
  5. ; Revised on  :  11/01/95
  6. ; Revised by  :  Dan Shore
  7. ; Purpose     :  To let user choose which set of 20 tagged messages to
  8. ;                read instead of *forcing* only the first 20.  Three new
  9. ;                subroutines added:  DISPLAY_MSG_SETS, GET_NEXT_VALUE
  10. ;                PROCESSED_TAGGED
  11. ;
  12. ;──────────────────────────────────────────────────────────────────────────────
  13. ;
  14. ;   To be used with Msg Tagging PPE (QSCAN, MEC, MORE, READ, RECOVER, KILL)
  15. ;
  16. ;    1) Edit your CMD.LST file(s) to add this:
  17. ;
  18. ;                             Charges Per     PPE/MNU File Specification -or-
  19. ;            Command    Sec  Minute    Use    Keystroke Substitution
  20. ;        ══════════════ ═══ ═════════════════ ═════════════════════════════════
  21. ;     1) R                5        0        0 C:\PCB\PPE\READ\READ.PPE
  22. ;
  23. ;       Note: You may have to change the pathname to the PPE.
  24. ;
  25. ;──────────────────────────────────────────────────────────────────────────────
  26. STRING main_prompt       '  Common prompt display variable
  27. STRING tag_msg_file      '  File that contains tagged msgs
  28. STRING hold              '  Generic string variable
  29. STRING hold2             '  Garbage variable
  30. STRING start_msg_num     '  Starting msg number when reading a set
  31. STRING end_msg_num       '  Ending msg number when reading a set
  32.  
  33. BIGSTR user_input_temp   '  Temp variable for parsing information
  34. BIGSTR user_input        '  Common user input variable - used with tagged msgs
  35. BIGSTR temp              '  Generic string variable - used for reading tag list
  36.  
  37. INT cmd_line_count       '  Count number of command line parms
  38. INT x                    '  Generic int variable
  39. INT    msg_num_count     '  Number of tagged messages
  40. INT    set_number        '  20 Msg number set
  41. ;──────────────────────────────────────────────────────────────────────────────
  42.  
  43.  
  44. cmd_line_count = TOKCOUNT()
  45.  
  46. IF (cmd_line_count) THEN
  47.  
  48.   '
  49.   '  Get path to swap file directory
  50.   '
  51.   hold = READLINE(PCBDAT(),204)
  52.   hold = FILEINF(hold,6) + ":" + FILEINF(hold,7)
  53.  
  54.   '
  55.   '  Determine paths and names of files used by READ.PPE
  56.   '
  57.   tag_msg_file = hold + "mtg" + STRING(CURCONF()) + ".lst"
  58.  
  59.   '
  60.   '  Process command line (stacked) commands
  61.   '
  62.   hold = ""
  63.   FOR x = 1 TO cmd_line_count
  64.     hold = hold + UPPER(GETTOKEN()) + ";"
  65.   NEXT
  66.  
  67.   '
  68.   '  If user did not enter TAG, stuff the keyboard with their input
  69.   '
  70.   IF (!INSTR(hold,"TAG")) THEN
  71.     KBDSTUFF "R;" + hold + CHR(13)
  72.     GOTO EXIT_PROG
  73.   '
  74.   '  Get the list of tagged msgs and process
  75.   '
  76.   ELSE
  77.     GOTO UNTAG_MSGS
  78.   END IF
  79. END IF
  80.  
  81. '
  82. '  No commands stacked after the "R"ead command
  83. '
  84. IF (EXIST(PPEPATH()+"read")) DISPFILE PPEPATH()+"read", LANG+GRAPH
  85. PRINT "@X0BYou are currently in Conference: @X0A@CONFNAME@ @X07[@X0F@CONFNUM@@X07]"
  86. NEWLINE
  87.  
  88. '
  89. '  If we have tagged msgs, display a special prompt otherwise just stuff
  90. '  the "R"ead command alone back to PCB.
  91. '
  92. IF (EXIST(tag_msg_file)) THEN
  93.   IF (FILEINF(tag_msg_file,4) > 0) THEN
  94.     user_input = ""
  95.     hold = STRING(LOMSGNUM()) + "-" + STRING(HIMSGNUM())
  96.     main_prompt = "@X02[@X0FH@X02]elp,@X02(@X0F" + hold + "@X02),@X02(@X0FTAG@X02)=@X03@X0BTagged @X03Msgs, @X0EEnter your message command"
  97.     INPUTSTR main_prompt, user_input, @X0E, 250, MASK_ASCII(), UPCASE+LFAFTER
  98.     IF (user_input = "") GOTO EXIT_PROG
  99.     IF (user_input = "TAG") GOTO UNTAG_MSGS
  100.   ELSE
  101.     DELETE tag_msg_file
  102.   END IF
  103. END IF
  104.  
  105. KBDSTUFF "R " + CHR(13)
  106. GOTO EXIT_PROG
  107.  
  108. '
  109. '  Read the disk file that has the tagged msg and stuff the keyboard with
  110. '  the read command and the msg numbers.
  111. '
  112. :UNTAG_MSGS
  113.  
  114.   '
  115.   '  Read tagged messages from disk file MTG?.LST
  116.   '
  117.   GOSUB PROCESS_TAGGED
  118.  
  119.   '
  120.   '  See how many tokens there are.  Remember that TOKCOUNT will only
  121.   '  report the number of tokens it finds up to the 256th character
  122.   '  in the string user_input.
  123.   '
  124.   '  It will be able to report more than 20 tokens even if the
  125.   '  message numbers are 9 characters long.
  126.   '
  127.   '  9 characters for msg number, 1 char for semi-colon = 10 chars
  128.   '  256 characters / 10 = 25.6 msg numbers
  129.   '
  130.   TOKENIZE user_input
  131.   msg_num_count = TOKCOUNT()
  132.   IF (msg_num_count > 20) THEN
  133.     '
  134.     '  Display to the user the SETS of 20 tagged messages
  135.     '
  136.     GOSUB DISPLAY_MSG_SETS
  137.     '
  138.     '  Prompt the user which SET of msgs they wish to read
  139.     '
  140.     hold = ""
  141.     main_prompt = "       @X0BChoose set number to read @X0E(Enter=quit)@X07"
  142.     INPUTSTR main_prompt, hold, @X0E, 2, MASK_NUM(), LFAFTER+GUIDE+FIELDLEN
  143.     IF (hold != "") THEN
  144.       '
  145.       '  temp is a string variable that contains the starting and ending
  146.       '  message numbers of each set.  We read this variable and once
  147.       '  we get the starting and ending numbers, we can get the whole
  148.       '  range of numbers (20) from the variable user_input.  user_input
  149.       '  contains ALL the tagged message numbers.
  150.       '
  151.       TOKENIZE temp
  152.       FOR x = 1 to set_number
  153.         '
  154.         '  Retrieve first set of staring and ending message numbers
  155.         '
  156.         hold2 = GETTOKEN()
  157.         '
  158.         '  See if the loop count matches the users input for set to read
  159.         '
  160.         IF (x = TOINT(hold)) THEN
  161.           '
  162.           '  Get starting and ending message number
  163.           '
  164.           start_msg_num = MID(hold2,1,INSTR(hold2,",")-1)
  165.           end_msg_num = MID(hold2,INSTR(hold2,",")+1, LEN(hold2)-INSTR(hold2,","))
  166.           '
  167.           '  Get set of 20 message numbers from user_input and put
  168.           '  range in user_input.  Break out of FOR loop so we can
  169.           '  stuff the keyboard user_input
  170.           '
  171.           user_input = MID(user_input, INSTR(user_input, start_msg_num), INSTR(user_input, end_msg_num) - INSTR(user_input, start_msg_num) + LEN(end_msg_num))
  172.           BREAK
  173.         END IF
  174.       NEXT
  175.     '
  176.     '  User hit CR to the Message command prompt
  177.     '
  178.     ELSE
  179.       user_input = ""
  180.     END IF
  181.   END IF
  182.   '
  183.   '  Stuff keyboard with user_input.  (message numbers to read or nothing)
  184.   '
  185.   KBDSTUFF CHR(13) + "R;" + user_input + CHR(13)
  186.   END
  187.   IF (user_input != "") KBDSTUFF "R;" + user_input
  188.  
  189. :EXIT_PROG
  190.  
  191.   END
  192.  
  193. '
  194. ' Read the tagged files (disk file) into user_input
  195. '
  196. :PROCESS_TAGGED
  197.  
  198.    FOPEN 1, tag_msg_file, O_RD, S_DN
  199.    FREAD 1, user_input, FILEINF(tag_msg_file,4)
  200.    FCLOSE 1
  201.    RETURN
  202. '
  203. '
  204. '
  205. :DISPLAY_MSG_SETS
  206.  
  207.   '
  208.   '  Display information screen so user knows what is happening
  209.   '
  210.   PRINTLN
  211.   PRINTLN "@X0E┌──────────────────────────────────────────────────────────────┐"
  212.   PRINTLN "│@X0BDue to a limitation of PCBoard, only 20 Message numbers can be@X0E│"
  213.   PRINTLN "│@X0Bstacked to read at one time.  Pick the @X0DSET NUMBER@X0B of tagged   @X0E│"
  214.   PRINTLN "│@X0Bmessages you wish to read.                                    @X0E│"
  215.   PRINTLN "@X0E└──────────────────────────────────────────────────────────────┘"
  216.   PRINTLN
  217.  
  218.   '
  219.   '  Display our set number heading
  220.   '
  221.   PRINTLN "@X0FSet #  @X0CTagged Message Numbers@X07"
  222.   PRINTLN "@X0A─────  ────────────────────────────────────────────────────────"
  223.  
  224.   '
  225.   '  Start our set number at 1, and start the set number display of msg #'s
  226.   '
  227.   set_number = 1
  228.   PRINT SPACE(3-LEN(STRING(set_number))), "@X0F", set_number, SPACE(4)
  229.  
  230.   '
  231.   '  Initialize variables to starting values
  232.   '
  233.   '  x = the number of message numbers we have printed to the screen
  234.   '
  235.   '  temp is a string variable that contains the starting and ending
  236.   '  message numbers of each set and has the format of:
  237.   '
  238.   '         start,end;start,end;start,end;
  239.   '
  240.   x = 0
  241.   temp = ""
  242.  
  243.   '
  244.   '  Place user_input value into user_input_temp so we can parse it
  245.   '  and not destroy the contents of user_input which we will need once
  246.   '  the user decides which set to read.
  247.   '
  248.   user_input_temp = user_input
  249.  
  250.   '
  251.   '  Process our first number, print it to the screen, and add the
  252.   '  staring number for this set to temp variable.  Increment the
  253.   '  number of message numbers printed to screen (x)
  254.   '
  255.   GOSUB GET_NEXT_VALUE
  256.   PRINT "@X02", hold, " "
  257.   temp = hold + ","
  258.   INC x
  259.  
  260.   '
  261.   '  Process the remaining numbers
  262.   '
  263.   WHILE (1) DO
  264.     '
  265.     '  If we have reached our 20th message number, do this section
  266.     '
  267.     IF (x = 20) THEN
  268.       '
  269.       '  If 20th number, add ending number to temp variable,
  270.       '  and set the number of messages printed to the screen
  271.       '  to 0 in prepartion for displaying next set.
  272.       '
  273.       temp = temp + hold + ";"
  274.       x = 0
  275.       PRINTLN
  276.       PRINTLN
  277.       '
  278.       '  Get our next message number
  279.       '
  280.       GOSUB GET_NEXT_VALUE
  281.       '
  282.       '  If no more message numbers (hold = ""), then break out of WHILE loop
  283.       '
  284.       IF (hold = "") THEN
  285.         temp = temp + hold2 + ";"
  286.         BREAK
  287.       END IF
  288.       '
  289.       '  Print next set number since we have more message numbers to process
  290.       '
  291.       INC set_number
  292.       PRINT SPACE(3-LEN(STRING(set_number))), "@X0F",set_number, SPACE(4)
  293.  
  294.       '
  295.       '  Process our first number of the next set, print it to the screen, and
  296.       '  add the starting number for this set to temp variable.  Increment the
  297.       '  number of message numbers printed to screen (x), and increment the
  298.       '  set number
  299.       '
  300.       PRINT "@X02", hold, " "
  301.       temp = temp + hold + ","
  302.       INC x
  303.       '
  304.       '  Go back to the WHILE statement as we have processed our 20th msg
  305.       '  number and we do not want to process command below this
  306.       '
  307.       CONTINUE
  308.     '
  309.     '  If we have reached our 10th message number, go to the next line
  310.     '  on the screen and print 7 spaces for lining up of message numbers
  311.     '  in two rows of ten numbers each
  312.     '
  313.     ELSE IF (x = 10) THEN
  314.       PRINTLN
  315.       PRINT SPACE(7)
  316.     END IF
  317.  
  318.     '
  319.     '  Process the next number and display it on the screen
  320.     '
  321.     GOSUB GET_NEXT_VALUE
  322.     '
  323.     '  If no more message numbers (hold = ""), then break out of WHILE loop
  324.     '
  325.     IF (hold = "") THEN
  326.       temp = temp + hold2 + ";"
  327.       NEWLINES 2
  328.       BREAK
  329.     END IF
  330.     '
  331.     '  Print the message number to the screen
  332.     '
  333.     PRINT "@X02", hold, " "
  334.     INC x
  335.     hold2 = hold
  336.  
  337.   END WHILE
  338.   RETURN
  339.  
  340. '
  341. '  This routine was written due to GETOKEN not being able to parse past
  342. '  the 256th character of a string.  Reported to CDC on 11/1/95
  343. '
  344. '  hold is the variable that contains the next value
  345. '  parsed from the user_input_temp variable
  346. '
  347. :GET_NEXT_VALUE
  348.  
  349.   hold = MID(user_input_temp, 1, INSTR(user_input_temp, ";")-1)
  350.   user_input_temp = MID(user_input_temp, INSTR(user_input_temp, ";")+1, LEN(user_input_temp)-INSTR(user_input_temp,";"))
  351.   RETURN
  352.  
  353.